<%@ Page Title="Edit Lend" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="EditLend.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.Edit_Entities.EditLend" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">

        .style18
        {
            width: 74px;
            height: 30px;
        }
        .style20
        {
            height: 30px;
        }
        .style21
        {
        }
    .style16
    {
        width: 8px;
        }
        .style24
        {
            width: 188px;
            height: 28px;
        }
        
        .style34
        {
            width: 95%;
            height: 24px;
        }
        .style36
        {
            height: 28px;
            width: 196px;
        }
        .style38
        {
            height: 28px;
            width: 130px;
        }
        .style41
        {
            width: 62px;
        }
        .style42
        {
            width: 196px;
        }
        .style44
        {
            width: 188px;
        }
        .style45
        {
            width: 130px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1" align="left" style="margin-right: 0px">
        <tr>
            <td align="center" colspan="4" bgcolor="White">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="SentLabel" runat="server" BackColor="#FFFFCC" 
                    ForeColor="#607894" Text="Mail Sent" Visible="False"></asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4" bgcolor="White">
                <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="1000">
                    <ProgressTemplate>
                        <img alt="" src="../../images/update.gif"/>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </td>
        </tr>
        <tr>
            <td class="style45">
                <asp:Label ID="Label5" runat="server" Text="User"></asp:Label>
            </td>
            <td class="style44">
                <cc1:ComboBox ID="USer2ComboBox" runat="server" AppendDataBoundItems="True" 
                    AutoCompleteMode="Append" DataSourceID="UserObjectDataSource" 
                    DataTextField="user_name" DataValueField="user_num" 
                    DropDownStyle="DropDownList" MaxLength="0" 
                    ondatabound="USer2ComboBox_DataBound" style="display: inline;">
                </cc1:ComboBox>
            </td>
            <td class="style41">
                <asp:Label ID="Label6" runat="server" Text="Customer"></asp:Label>
            </td>
            <td class="style42">
                <cc1:ComboBox ID="Customer2ComboBox" runat="server" AppendDataBoundItems="True" 
                    AutoCompleteMode="Append" DataSourceID="CustomerObjectDataSource" 
                    DataTextField="customer_name" DataValueField="customer_num" 
                    DropDownStyle="DropDownList" MaxLength="0" 
                    ondatabound="Customer2ComboBox_DataBound" style="display: inline;">
                </cc1:ComboBox>
            </td>
        </tr>
        <tr>
            <td class="style45">
                <asp:Label ID="Label7" runat="server" Text="Item"></asp:Label>
            </td>
            <td class="style44">
                <cc1:ComboBox ID="Item2ComboBox" runat="server" AppendDataBoundItems="True" 
                    AutoCompleteMode="Append" DataSourceID="ItemObjectDataSource" 
                    DataTextField="lend_item_serial" DataValueField="lend_item_num" 
                    DropDownStyle="DropDownList" MaxLength="0" 
                    ondatabound="Item2ComboBox_DataBound" style="display: inline;">
                </cc1:ComboBox>
            </td>
            <td colspan="2">
                </td>
        </tr>
        <tr>
            <td class="style45" >
                <asp:Label ID="Label1" runat="server" Text="Start Date Between" 
                Width="137px"></asp:Label>
            </td>
            <td class="style44" >
                <asp:TextBox ID="SDFTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="SDFTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="SDFTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="SDFTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="SDFTextBox">
                </cc1:CalendarExtender>
            </td>
            <td>
                <asp:Label ID="Label10" runat="server" Text="And" 
                Width="34px"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="SDTTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="SDTTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="SDTTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="SDTTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="SDTTextBox">
                </cc1:CalendarExtender>
            </td>
        </tr>
        <tr>
            <td class="style45">
                <asp:Label ID="Label8" runat="server" Text="End Date Between" 
                Width="137px"></asp:Label>
            </td>
            <td class="style44">
                <asp:TextBox ID="EDFTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="EDFTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="EDFTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="EDFTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="EDFTextBox">
                </cc1:CalendarExtender>
            </td>
            <td>
                <asp:Label ID="Label15" runat="server" Text="And" 
                Width="34px"></asp:Label>
            </td>
            <td >
                <asp:TextBox ID="EDTTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="EDTTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="EDTTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="EDTTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="EDTTextBox">
                </cc1:CalendarExtender>
            </td>
        </tr>
        <tr>
            <td class="style38">
                <asp:Label ID="Label9" runat="server" Text="Returned Date Between" 
                Width="155px"></asp:Label>
            </td>
            <td class="style24">
                <asp:TextBox ID="RDFTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="RDFTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="RDFTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="RDFTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="RDFTextBox">
                </cc1:CalendarExtender>
            </td>
            <td class="style41">
                <asp:Label ID="Label16" runat="server" Text="And" 
                Width="34px"></asp:Label>
            </td>
            <td class="style36">
                <asp:TextBox ID="RDTTextBox" runat="server"></asp:TextBox>
                <cc1:MaskedEditExtender ID="RDTTextBox_MaskedEditExtender" runat="server" 
                    TargetControlID="RDTTextBox" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                </cc1:MaskedEditExtender>
                <cc1:CalendarExtender ID="RDTTextBox_CalendarExtender" runat="server" 
                    Format="dd/MM/yyyy" TargetControlID="RDTTextBox">
                </cc1:CalendarExtender>
            </td>
        </tr>
        <tr>
            <td colspan="3" bgcolor="#E3E6EA">
               </td>
            <td class="style36" bgcolor="#E3E6EA">
            <asp:Button ID="Button1" runat="server" BackColor="#FFFBFF" 
 BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"  
 Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Text="Go" Width="76px" 
                    onclick="Button1_Click"/>
            </td>
        </tr>
        <tr>
            <td class="style21" colspan="4">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:DetailsView ID="LendDetailsView" runat="server" AllowPaging="True" 
                    AutoGenerateRows="False" CellPadding="4" DataKeyNames="lend_num" 
                    DataSourceID="LendObjectDataSource" ForeColor="#333333" GridLines="None" 
                    Height="50px" ondatabound="LendDetailsView_DataBound" 
                    onitemcommand="LendDetailsView_ItemCommand" 
                    onitemupdated="LendDetailsView_ItemUpdated" Width="508px">
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <Fields>
                                <asp:BoundField DataField="lend_num" HeaderText="lend_num" ReadOnly="True" 
                            SortExpression="lend_num" Visible="False" />
                                <asp:TemplateField HeaderText="User" SortExpression="lend_user">
                                    <EditItemTemplate>
                                        <cc1:ComboBox ID="ComboBox1" runat="server" AppendDataBoundItems="True" 
                                    AutoCompleteMode="Append" DataSourceID="UserObjectDataSource" 
                                    DataTextField="user_name" DataValueField="user_num" MaxLength="0" 
                                    SelectedValue='<%# Bind("lend_user") %>' style="display: inline;">
                                        </cc1:ComboBox>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("lend_user") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="UserLabel" runat="server" Text='<%# Bind("lend_user") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Customer" SortExpression="lend_customer">
                                    <EditItemTemplate>
                                        <cc1:ComboBox ID="ComboBox2" runat="server" AppendDataBoundItems="True" 
                                    AutoCompleteMode="Append" DataSourceID="CustomerObjectDataSource" 
                                    DataTextField="customer_name" DataValueField="customer_num" MaxLength="0" 
                                    SelectedValue='<%# Bind("lend_customer") %>' style="display: inline;">
                                        </cc1:ComboBox>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("lend_customer") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="CustomerLabel" runat="server" 
                                    Text='<%# Bind("lend_customer") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item" SortExpression="lend_item_num">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="ItemTextBox" runat="server" 
                                    Text='<%# Bind("lend_item_num") %>' Visible="False"></asp:TextBox>
                                        <asp:Label ID="cantEdit3" runat="server" ForeColor="Maroon" Text="Can't Edit"></asp:Label>
                                        <asp:CheckBox ID="AvailableCheckBox" runat="server" 
                                    ondatabinding="AvailableCheckBox_DataBinding" Text="Is Available" />
                                        <br />
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("lend_item_num") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="ItemLabel" runat="server" Text='<%# Bind("lend_item_num") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Start Date" SortExpression="lend_start_date">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox3" runat="server" ReadOnly="True" 
                                    Text='<%# Bind("lend_start_date") %>' Enabled="False"></asp:TextBox>
                                        <cc1:CalendarExtender ID="TextBox3_CalendarExtender" runat="server" 
                                            Format="dd/MM/yyyy" TargetControlID="TextBox3">
                                        </cc1:CalendarExtender>
                                        <cc1:MaskedEditExtender ID="TextBox3_MaskedEditExtender" runat="server" 
                                            TargetControlID="TextBox3" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                                        </cc1:MaskedEditExtender>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("lend_start_date") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("lend_start_date") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="End Date" SortExpression="lend_end_date">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" ReadOnly="True" 
                                    Text='<%# Bind("lend_end_date") %>' Enabled="False"></asp:TextBox>
                                        <cc1:MaskedEditExtender ID="TextBox2_MaskedEditExtender" runat="server" 
                                            TargetControlID="TextBox2" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear">
                                        </cc1:MaskedEditExtender>
                                        <cc1:CalendarExtender ID="TextBox2_CalendarExtender" runat="server" 
                                            TargetControlID="TextBox2" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("lend_end_date") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("lend_end_date") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Returned Date" 
                            SortExpression="lend_returned_date">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%# Bind("lend_returned_date") %>'></asp:TextBox>
                                        <cc1:MaskedEditExtender ID="TextBox1_MaskedEditExtender" runat="server" 
                                            TargetControlID="TextBox1" Mask="99/99/9999" MaskType="Date" 
                    UserDateFormat="DayMonthYear" Enabled="True">
                                        </cc1:MaskedEditExtender>
                                        <cc1:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" TargetControlID="TextBox1">
                                        </cc1:CalendarExtender>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%# Bind("lend_returned_date") %>'></asp:TextBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("lend_returned_date") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                                <asp:ButtonField CommandName="MailLend" Text="Mail Lend Details" />
                            </Fields>
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:DetailsView>
                        <br />
                        <asp:Panel ID="MailPanel1" runat="server" BorderStyle="Groove" 
                            CssClass="style34" Height="348px" Visible="False" Width="641px">
                            <br />
                            <asp:RadioButton ID="CustomerRadioButton" runat="server" Checked="True" 
                                GroupName="Group1" Text="Send This Component to it's Customer" />
                            <br />
                            <asp:RadioButton ID="UserRadioButton" runat="server" GroupName="Group1" 
                                Text="Send This Component to the following User" />
                            &nbsp;<cc1:ComboBox ID="UserComboBox" runat="server" AppendDataBoundItems="True" 
                                AutoCompleteMode="Append" DataSourceID="UserObjectDataSourceMail" 
                                DataTextField="user_name" DataValueField="user_num" 
                                DropDownStyle="DropDownList" MaxLength="0" style="display: inline;">
                            </cc1:ComboBox>
                            <br />
                            <br />
                            Add Notes:<br />
                            <asp:TextBox ID="NotesTextBox" runat="server" Height="146px" 
                                TextMode="MultiLine" Width="629px" ForeColor="Black"></asp:TextBox>
                            <br />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:Button ID="SendButton" runat="server" BackColor="#FFFBFF" 
                                BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" 
                                Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Height="25px" 
                                onclick="SendButton_Click" style="text-align: center" Text="Send Mail" 
                                Width="99px" />
                            <br />
                        </asp:Panel>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td class="style10" colspan="4">
                <asp:ObjectDataSource ID="UserObjectDataSourceMail" runat="server" 
                    SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL">
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="LendObjectDataSource" runat="server" SelectMethod="LendSearch" 
                    TypeName="WarehouseWebAPP.code.BLL.LendBLL" UpdateMethod="LendUpdate" 
                    DeleteMethod="LendDelete">
                    <UpdateParameters>
                        <asp:Parameter DbType="Guid" Name="lend_user" />
                        <asp:Parameter DbType="Guid" Name="lend_customer" />
                        <asp:Parameter DbType="Guid" Name="lend_item_num" />
                        <asp:Parameter Name="lend_start_date" Type="DateTime" />
                        <asp:Parameter Name="lend_end_date" Type="DateTime" />
                        <asp:Parameter Name="lend_returned_date" Type="DateTime" />
                        <asp:Parameter DbType="Guid" Name="lend_num" />
                    </UpdateParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="Item2ComboBox" DefaultValue="%" 
                            Name="lend_item_num" PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="USer2ComboBox" DefaultValue="%" 
                            Name="lend_user" PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="Customer2ComboBox" DefaultValue="%" 
                            Name="lend_customer" PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="SDFTextBox" DefaultValue="1/1/1753" 
                            Name="lend_start_date_from" PropertyName="Text" Type="DateTime" />
                        <asp:ControlParameter ControlID="SDTTextBox" DefaultValue="1/1/2200" 
                            Name="lend_start_date_to" PropertyName="Text" Type="DateTime" />
                        <asp:ControlParameter ControlID="EDFTextBox" DefaultValue="1/1/1753" 
                            Name="lend_end_date_from" PropertyName="Text" Type="DateTime" />
                        <asp:ControlParameter ControlID="EDTTextBox" DefaultValue="1/1/2200" 
                            Name="lend_end_date_to" PropertyName="Text" Type="DateTime" />
                        <asp:ControlParameter ControlID="RDFTextBox" DefaultValue="1/1/1753" 
                            Name="lend_returned_date_from" PropertyName="Text" Type="DateTime" />
                        <asp:ControlParameter ControlID="RDTTextBox" DefaultValue="1/1/2200" 
                            Name="lend_returned_date_to" PropertyName="Text" Type="DateTime" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="UserObjectDataSource" runat="server" 
                SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL">
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ItemObjectDataSource" runat="server" 
                SelectMethod="lendItemGet" TypeName="WarehouseWebAPP.code.BLL.LendItemBLL">
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="CustomerObjectDataSource" runat="server" 
                SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
                </asp:ObjectDataSource>
            </td>
        </tr>
        </table>
</asp:Content>
